package model;

public class Player {
	
	private String playerName;
	private int playerPoints;
	private Hand hand;
	private int avatar;
	private long cash;
	
	public Player(String playerName_, int avatar_, long cash_) {
		
		playerName = playerName_;
		playerPoints = 0;
		avatar = avatar_;
		cash = cash_;
		hand = new Hand();
		
	}
	
	public long getCash(){
		return cash;
	}
	
	public void recevicePot(long amount){
		cash=cash+amount;
	}
	
	public long bet(long amount) throws NotEnoughCashException {
		if (amount<cash){
			cash=cash-amount;
			return amount;
		}else{
			throw new NotEnoughCashException();
		}
	}
	
	public void receiveCard(Deck deck) throws NoSuchCardException {
		hand.addCard(deck);
	}
	
	public int getLatestCardRank() throws NoSuchCardException {
		return hand.getLatestAddedCardRank();
	}
	
	public String getPlayerName() {
		return playerName;
	}
	
	public void addPoints(int points) {
		playerPoints = playerPoints + points;
	}
	
	public int getPoints() {
		
		return playerPoints;
	
	}
	
	public Hand getHand() {
		
		return hand;
	
	}
	
	public String toString() {
		return hand.toString();
	}
	
	public int getAvatar(){
		return avatar;
	}
	
	
	
}
